<?php if (isset($debug_page) && $debug_page === TRUE): ?>
    <link href="bootstrap_ace/css/bootstrap.css" rel="stylesheet">
    <link href="css/main.css" rel="stylesheet">
<?php endif; ?>
<?php if (!isset($my_position)) $my_position =& get_instance()->router->class; ?>
<div class="main-container" id="main-container">
    <div id="sidebar" class="sidebar responsive">
        <ul class="nav nav-list">
            <?php
            $sys_adm_menus = 'xxxx';
            $MenuId = sprintf('Menu-%X', crc32($sys_adm_menus));
            ?>
            <?php $menu = config_item('page_menu');
            if(isset($_SESSION['privilege_ids']))
            foreach ($menu as $k => $v): ?>
                <?php if ($v['is_first'] && (in_array($v['pri_id'], $_SESSION['privilege_ids']) || $_SESSION['is_web_admin_role'])): ?>
                    <li class="<?php if ($my_position == $v['position'] || (isset($v['other_active']) && in_array($my_position, $v['other_active']))) {echo 'active';} ?>">
                        <a href="<?php echo site_url("{$v['site_url']}"); ?>">
                            <i class="<?php echo $v['icon']; ?>"></i>
                            <span class="menu-text"> <?php echo $v['title']; ?> </span>
                        </a> <b class="arrow"></b>
                    </li>
                    <?php elseif(in_array($v['pri_id'], $_SESSION['privilege_ids']) || $_SESSION['is_web_admin_role']): ?>
                    <?php
                    $sys_adm_menus = [];
                    if ($v['child_list']) {
                        foreach ($v['child_list'] as $k0 => $v0) {
                            if(in_array($v0['pri_id'], $_SESSION['privilege_ids']) || $_SESSION['is_web_admin_role']) {
                                $sys_adm_menus[] = $v0['position'];
                            }
                        }
                        $sys_adm_menus = isset($v['other_active']) ? array_merge($v['other_active'], $sys_adm_menus) : $sys_adm_menus;
                    }

                    ?>
                    <li class="<?php if (in_array($my_position, $sys_adm_menus)) echo ' open active'; ?>">
                    <a href="#" class="dropdown-toggle"> <i class="<?php echo $v['icon']; ?>"></i>
                        <span class="menu-text"> <?php echo $v['title']; ?> </span> <b class="arrow fa fa-angle-down"></b> </a>
                    <b class="arrow"></b>
                    <ul class="submenu">
                        <?php foreach ($v['child_list'] as $k2 => $v2): if(in_array($v2['pri_id'], $_SESSION['privilege_ids']) || $_SESSION['is_web_admin_role']):?>
                            <li class="<?php if ($my_position == $v2['position']) {echo 'active';} ?>">
                                <a href="<?php echo site_url("{$v2['site_url']}"); ?>">
                                    <i class="menu-icon fa fa-caret-right"></i> <?php echo $v2['title']; ?> </a>
                                <b class="arrow"></b>
                            </li>
                        <?php endif;endforeach; ?>
                    </ul>
                <?php endif; ?>
                </li>
            <?php endforeach; ?>
        </ul><!-- /.nav-list -->

        <!--<script>
            try {
                ace.settings.check('sidebar', 'collapsed')
            } catch (e) {
            }
        </script>-->
    </div>



